<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title></title>
		<#include "/admin/include/head.htm">

        <script src="${base}/resource/thirdparty/city/City.js"></script>
        <script src="${base}/resource/thirdparty/city/cityPicker.js"></script>
        <link rel="stylesheet" type="text/css" href="${base}/resource/thirdparty/city/cityPicker.css">
		<script type="text/javascript">
			$(function() {
				var mainform = $("#mainform");
				//表单底部按钮
				LG.setFormDefaultBtn(f_cancel, function() {
					f_save(mainform, "b2c_store_city");
				});


			});
		</script>
	</head>
	<#if !city??>
	<#assign isAdd = true />
	<#else>
	<#assign isEdit = true />
	</#if>
	<body style="overflow:hidden;padding:10px;">
		<form action="<#if isAdd??>${base}/admin/b2c/storeCity/save.jhtml<#else>${base}/admin/b2c/storeCity/update.jhtml</#if>" method="post" id="mainform" class="validate">
			<div id="tabcontainer" style="overflow:hidden;margin:3px;">
				<#if !isAdd??>
				<input type="hidden" name="id" value="${(city.id)!''}"/>
				</#if>
				<table class="table" style="width:100%;">
					<tr>
						<th>城市名称:</th>
						<td>
                            <input type="text" name="name" id="cityChoice"  value="${(city.name)!''}" class="formText {required: true, maxlength: 20, remote:'${base}/admin/storeCity/checkCityName.jhtml?oldName=${(city.name)!''}', messages: {remote: '城市名称已存在!'}}" readonly="readonly">
                            <input type="hidden" id="province" value="">
                            <input type="hidden" id="city" name="code" value="">
						</td>
					</tr>
					<tr>
						<th>坐标X:</th>
						<td> <input type="text" name="xpoint" value="${(city.xpoint)!''}" readonly></td>
					</tr>
					<tr>
						<th>坐标Y:</th>
                        <td>
							<input type="text" name="ypoint" value="${(city.ypoint)!''}" readonly>
						</td>
					</tr>
					<tr>
						<th>是否有效:</th>
                        <td>
							<@u.radio name= "is_effect" list={"true":"是", "false": "否"}
							value="${(city.is_effect?string('true', 'false'))!'true'}"/>
						</td>
					</tr>
					<tr>
						<th>排序:</th>
						<td>
						<input type="text" name="priority" value="${(city.priority)!10}"
						class="formText {digits: true, maxlength:3}" title="只允许输入零或正整数"/>
						</td>
					</tr>
				</table>
			</div>
		</form>
	</body>

<script>
    var cityPicker = new IIInsomniaCityPicker({
        data: cityData,
        target: '#cityChoice',
        valType: 'v',
        hideCityInput: '#city',
        hideProvinceInput: '#province',
        callback: function(xy){
           $("input[name=xpoint]").val(xy.split(",")[0]);
           $("input[name=ypoint]").val(xy.split(",")[1]);
        }
    });

    cityPicker.init();

</script>
</html>